#ifndef ENEMY_H
#define ENEMY_H

#include "Entity.h"
#include "Waypoint.h"

class AttackWallMediator;
class TargetMediator;
class EntityManager;
class EntityFactory;
class Enemy : public Entity
{
public:
	enum EStatus
	{
		Normal,
		Slow
	};

	Enemy(const EEntityType& entity_type, TargetMediator* target_mediator, AttackWallMediator* attack_wall_mediator, EntityFactory* entity_factory, EntityManager* entity_manager);
	virtual ~Enemy(void);

	virtual void Init(SceneObject* scene_object, Grid* grid);
	virtual void Update(float deltatime);

	void AddWaypoint(Waypoint waypoint);
	TargetMediator* GetTargetMediator() const { return m_target_mediator; }
	void SetHealth(int health) { m_health = health; }
	void ModifyHealth(int health_mod) { m_health += health_mod; }
	void SetStatus(EStatus status) { m_status = status; }
	void SetSlowTime(float slow_time) { m_slow_time = slow_time; }
	void ResetSlowTime() { m_curr_slow_time = m_slow_time; }

protected:
	AttackWallMediator* m_attack_wall_mediator;
	TargetMediator* m_target_mediator;
	EntityManager* m_entity_manager;
	EntityFactory* m_entity_factory;

	Waypoint m_waypoint;
	EStatus m_status;

	Vector3 m_next_location;

	Vector3 m_direction;
	Vector3 m_goal_direction;

	float m_distance;
	float m_speed;
	float m_slow_speed;
	float m_rot_speed;
	float m_shoot_time;
	float m_curr_shoot_time;
	float m_slow_time;
	float m_curr_slow_time;
	int m_health;

	DirectX::XMFLOAT4X4 m_transform_mat;

	void SetMatrixValues(float deltatime);
	void Shoot(Entity* target, float deltatime);
	void SetShootTime(float shoot_time) { m_shoot_time = shoot_time; }
};

#endif //ENEMY_H